package com.microservice.product.feign;

import com.microservice.common.R;
import com.microservice.product.dto.ProductInfoDTO;
import com.microservice.product.param.ProductReduceParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * write something please~
 *
 * @author huangrz
 * @since 2021/9/15
 **/
@FeignClient(name = "microservice-product", path = "/product")
//@RequestMapping("/product")  不能在类上面加该注解，否则SpringMVC框架会给这个类生成对应的HandlerMapping代理类，并对外提供接口，然后会造成`microservice-product`服务的接口被直接透传对外。
public interface ProductClient {

    @PostMapping("/reduce")
    R<Boolean> reduce(@RequestBody ProductReduceParam param);

    @GetMapping("/get/{id}")
    R<ProductInfoDTO> getById(@PathVariable Long id);
}
